import java.util.LinkedList;

public class RCB {

  private int RID; // resource ID
  private LinkedList<PCB> waitingList = new LinkedList<PCB>(); // list of
							       // blocked
							       // processes
							       // waiting on
  // resource
  private int freeUnits; // counter for number of free units
  private int maxUnits; // max units for the resource

  public RCB(int RID) {
    this.RID = RID;
    freeUnits = RID; // Each Ri has i free units
    maxUnits = RID;
  }

  public LinkedList<PCB> getWaitingList() {
    return waitingList;
  }

  public void setFreeUnits(int units) {
    this.freeUnits = units;
  }

  public int getFreeUnits() {
    return freeUnits;
  }

  public int getRID() {
    return RID;
  }

  public int getMaxUnits() {
    return maxUnits;
  }
  public boolean equals(Object other) {
    if (this == other) {
      return true;
    }
    if (other instanceof RCB) {
      RCB others = (RCB) other;
      return (others.getRID() == this.getRID());
    } else
      return false;
  }

}
